//
// Created by Admin on 2023/5/21.
//

#ifndef SIMPLE_SUPERMARKET_SALES_SYSTEM_SHOPPINGCART_H
#define SIMPLE_SUPERMARKET_SALES_SYSTEM_SHOPPINGCART_H

#include <vector>

class Book;

class Visitor
{
public:
    virtual void visitor(Book* book) = 0;
};

class Cashier : public Visitor
{
private:
    double totalForCart;

public:
    void visitor(Book* book);

    double getTotal();
};

class Item
{
public:
    virtual void accept(Visitor* visitor) = 0;

    virtual double getPrice() = 0;
};

class Book : public Item
{
private:
    double price;

public:
    Book(double price);

    void accept(Visitor* visitor);

    double getPrice();
};

class ShoppingCart
{
private:
    std::vector<Item*> items;

public:
    double calculatePrice();

    void add(Item* e);
};

#endif // SIMPLE_SUPERMARKET_SALES_SYSTEM_SHOPPINGCART_H
